package com.erp.warehouse.clouderp_warehouse.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 2025/11/3 15:27
 * author: 向远洋
 */
@Component
public class Task {
    @Autowired
    RedisUtil redisUtil;
    /**
     * 每天凌晨执行一次，初始化redis中（用来生成唯一编号的）的数据
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void initRedisKey() {
        System.out.println("进入定时器");
        String companyCode = "CNY001"; //测试数据
        String[] ywArr = {"INBOUND", "OUTBOUND", "ALLOT", "CHECK_STOCK", "QUALITY_INSPECTION"};
        for (String key : ywArr) {
            redisUtil.setStr(companyCode + ":" + key, "1");
        }
    }
}
